/**
 *  Modul mCtrlBrk pro operacni system AltairOS
 *
 *  modul se zavesi na preruseni int 1Bh,
 *  kde bude obsluhovat tento interrupt
 *
 *  Provede se pri kazdem stisknuti kombinace
 *  klaves Ctrl + Pause/Break
 */

#include <altair/module.h>
#include <altair/system/system.h>

#include <stdio/putchar.h>

/**
 *  interrupt (int 0x1B)
 *  provede se pri kazdem stisknuti kombinace klaves Ctrl + Pause/Break
 */
void interrupt _interrupt(void) {
  long krn_main= 0x10000000 + system_get_main_addr();

  asm cli                 ;
  asm mov dx, 0x1000      ;   /* segment jadra */
  asm mov ds, dx          ;
  asm mov es, dx          ;
  asm mov ss, dx          ;

  asm sti                 ;
  putch('\n');
  asm call dword ptr [krn_main] ;
  return;
}

/* hookujeme int 1Bh */
int _interrupt_no = 0x1B;
int main() {
  _interrupt();
  return 0;
}
